import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/basGoods/addOrSave',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/basGoods/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/basGoods/addOrSave',
    method: 'post',
    data
  })
}

export function enableOrDisable(data) {
  const obj = {
    url: 'api/basGoods/enableOrDisable',
    method: 'post',
    data
  }
  return request(obj)
}
export function get(params) {
  return request({
    url: 'api/basGoods',
    method: 'get',
    params
  })
}

export function getGoods(params) {
  return request({
    url: 'api/dropDown/basGoodsListForAdd',
    method: 'get',
    params
  })
}

export function getSalesHistory(params) {
  return request({
    url: '/api/basGoods/salesHistory',
    method: 'get',
    params
  })
}
export function getBuyHistory(params) {
  return request({
    url: '/api/basGoods/buyHistory',
    method: 'get',
    params
  })
}
export function newSalesHistory(params) {
  return request({
    url: '/api/basGoods/newSalesHistory',
    method: 'get',
    params
  })
}


//获取商品价格套
export function getPriceSuitInfo(params) {
  return request({
    url: '/api/dropDown/priceSuitInfo',
    method: 'get',
    params
  })
}

//获取商品价格套
export function basGoodsTypeTree(params) {
  return request({
    url: '/api/dropDown/basGoodsTypeTree',
    method: 'get',
    params
  })
}
//获取客户关联
export function relevance(params) {
  return request({
    url: '/api/basGoods/drawCustomers',
    method: 'get',
    params
  })
}
//保存客户关联
export function bindCustomers(data) {
  return request({
    url: '/api/basGoods/bindCustomers',
    method: 'post',
    data
  })
}

export function pushBasGoodsToMd(data) {
  return request({
    url: '/api/basGoods/pushBasGoodsToMd',
    method: 'post',
    data
  })
}
export default { add, edit, del, enableOrDisable, get, getGoods,relevance,bindCustomers,pushBasGoodsToMd }
